﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace WindowsFormsApp4
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }
        public static Dictionary<string, string> users = new Dictionary<string, string>();
        private void label1_Click(object sender, EventArgs e)
        {

        }
        //登录
        private void button1_Click(object sender, EventArgs e)
        {
            var sql = string.Format("select * from Users where Username='{0}'and Password='{1}'","myself","123456");

            var user = users.FirstOrDefault();

            var dt = DbHeper.GetDataTable(sql);

            if (dt.Rows .Count == 1)
            {
                MessageBox.Show("登录成功");
                Data data = new Data();
                this.Hide();
                data .Show();
            }
            else
            {
                MessageBox.Show("登录失败");
            }

        }
        //注册
        private void button2_Click(object sender, EventArgs e)
        {
            Register register = new Register();
            register.Show();
        }

        private void Form1_Load(object sender, EventArgs e)
        {
        }
    }
}
